package com.tonghu.bluetoothregistration.core;

import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothAdapter.LeScanCallback;
import android.bluetooth.BluetoothManager;
import android.content.Context;
import android.util.Log;

public class ScanDeviceIBeacon {
	
	private BluetoothAdapter mBluetoothAdapter;
	
	public void start(Context context) {
		final BluetoothManager bluetoothManager =
                (BluetoothManager) context.getSystemService(Context.BLUETOOTH_SERVICE);
        mBluetoothAdapter = bluetoothManager.getAdapter();
        Log.i("tonghu", "startScan");
        mBluetoothAdapter.startLeScan(leScanCallback);
	}
	
	public void stop() {
		if (mBluetoothAdapter != null) {
			mBluetoothAdapter.stopLeScan(leScanCallback);
		}
	}
	
	private LeScanCallback leScanCallback;
	
	public void setLeScanCallback(LeScanCallback leScanCallback) {
		this.leScanCallback = leScanCallback;
	}
	
}